local Prefix = '-' local GsubCase = {} for i, v in pairs(math) do GsubCase[i] = 'math.'..(i); end local CPlayer = getfenv().owner; local GraphThread = nil; local GraphParts = {} local GraphRate = 120; local MaxGraphParts = 64 ^ 1.25 MaxGraphParts = math.round(MaxGraphParts); local Commands = { ['del'] = { Context = 'Destroys the graph.'; }; ['new'] = { Context = 'Makes a new graph with the prefix as the first character, also does a stepped event for every tick for the math provided.' }; ['epm'] = { Context = 'Edits the max parts parameter.' } } CPlayer.Chatted:Connect(function(Message) if Message:sub(1,1):lower() == Prefix:lower() then local Command = Message:sub(string.len(Prefix), string.len(Message)):lower() local Split = { [1] = Command:sub(string.len(Prefix) + 1, string.len(Prefix) + 3):lower(); } if Split[1] == 'new' then local Gsubbed = Message:sub(3 + 3, 1000):gsub(Prefix, ''); for i, v in pairs(GsubCase) do Gsubbed = Gsubbed:gsub(i, v); end task.wait(); pcall(task.cancel, GraphThread) for i, v in pairs(GraphParts) do v:Destroy() end; table.clear(GraphParts); GraphThread = task.defer(function() while task.wait(1 / GraphRate) do if (#GraphParts + 1) >= MaxGraphParts then warn('Graph parts reached limit!') break end; local X = loadstring(string.format(`return %s`, Gsubbed:split("|")[1] or Gsubbed:gsub("|",'')))() or 0; local Y = loadstring(string.format(`return %s`, Gsubbed:split("|")[2] or Gsubbed:gsub("|",'')))() or 0; local GraphPart = Instance.new("Part", script); GraphPart.Name = 'Graph'; GraphPart.CanQuery = false; GraphPart.CastShadow = false; GraphPart.CanCollide = false; GraphPart.Anchored = true; GraphPart.CanTouch = false; GraphPart.Size = Vector3.one * 0.25; GraphPart.CFrame = CFrame.new((#GraphParts + 1) * GraphPart.Size.X, 5 + (Y), X) table.insert(GraphParts, GraphPart); end end) elseif Split[1] == 'del' then pcall(task.cancel, GraphThread); for i, v in pairs(GraphParts) do v:Destroy(); end table.clear(GraphParts); elseif Split[1] == 'epm' then MaxGraphParts = math.round(tonumber(Command:split(" ")[2])) end end end) warn('Getting commands') task.wait(#Commands / 10); table.foreach(Commands, warn) warn('Seperater info -> "|"\nThe first seperator item is the X and the second is the Y if none is provided the default is the message number or 0 if none is provided.')